﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace MyShowsPlugin
{
    public partial class Configuration : Form
    {
        public Configuration()

        {            
            InitializeComponent();
            Settings.Load();
            LogintextBox.Text = Settings.login;
            PasswordtextBox.Text = "******";
        }

        private void TestLoginButton_Click(object sender, EventArgs e)
        {
            bool success = MyShowUtility.Instance.Auth(this.LogintextBox.Text, this.PasswordtextBox.Text);
            if (success)
            {
                result.ForeColor = Color.Green;
                result.Text = "Login OK";
            }
            else
            {
                result.ForeColor = Color.Red;
                result.Text = "Login failed";
            }
        }

        public void LogintextBox_TextChanged(object sender, EventArgs e)
        {
            Settings.login = LogintextBox.Text;
        }

        private void PasswordtextBox_TextChanged(object sender, EventArgs e)
        {
            Settings.password = PasswordtextBox.Text;
        }

        private void OK_Click(object sender, EventArgs e)
        {

          
            Settings.Save();
            this.Close();
        }


        

    }
}
